<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>清除浮动方法2</title>
        <!-- 清除浮动方法2：给父级添加overflow: hidden/auto/scroll;(也是外边距合并解决父级盒子塌陷问题) -->
        <style>
            .box {
                overflow: hidden;
                width: 900px;
                background-color: gray;
                /* border: 1px solid blue; */
            }
    
            .box1 {
                float: left;
                width: 200px;
                height: 100px;
                background-color: red;
            }
    
            .box2 {
                float: left;
                width: 400px;
                height: 100px;
                background-color: purple;
            }
    
            .footer {
                width: 1000px;
                height: 250px;
                background-color: skyblue;
            }
    
          
        </style>
    </head>
    
    <body>
        <div class="box">
            <div class="box1">大猫</div>
            <div class="box2">小猫</div>
           
        </div>
        <div class="footer"></div>
    </body>
    
    </html>